﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Web.Configuration;
using System.Diagnostics;

namespace Lilium.Web.Mvc.Configuration
{
	public sealed class MvcConfigurationSection: ConfigurationSection
	{
		#region public string ScriptResourceController

		private const string ScriptResourceControllerPropertyName = "scriptResourceController";

		[ConfigurationPropertyAttribute(ScriptResourceControllerPropertyName, DefaultValue = "ScriptResource")]
		public string ScriptResourceController { [DebuggerNonUserCodeAttribute] get { return (string)base[ScriptResourceControllerPropertyName]; } [DebuggerNonUserCodeAttribute] set { base[ScriptResourceControllerPropertyName] = value; } }

		#endregion

		#region public ScriptLibraryElementCollection ResourceLibraries

		private const string ResourceLibrariesPropertyName = "resourceLibraries";

		[ConfigurationPropertyAttribute(ResourceLibrariesPropertyName)]
		public ScriptResourceLibraryElementCollection ResourceLibraries { [DebuggerNonUserCodeAttribute] get { return (ScriptResourceLibraryElementCollection)base[ResourceLibrariesPropertyName]; } }

		#endregion

		public static MvcConfigurationSection GetMvcConfigurationSection()
		{
			var section = (MvcConfigurationSection)WebConfigurationManager.GetSection("lilium.web.mvc");
			if (section == null)
				section = (MvcConfigurationSection)ConfigurationManager.GetSection("lilium.web.mvc");
			if (section == null)
				return new MvcConfigurationSection();
			return section;
		}
	}
}